﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EntityComponentSystem.Demo.Aspects;

namespace EntityComponentSystem.Demo
{
    public class GameEngine : EntityComponentSystem.Framework.Engine.GameEngine
    {
        public RicochetSystem RicochetSystem = null;
        public RenderSystem RenderSystem = null;

        public GameEngine(Form form)
        {
            RicochetSystem = new RicochetSystem(this);
            RenderSystem = new RenderSystem(this, form);

            var rcom = new RenderComponent();            
            RenderSystem.AddEntity(CreateEntity<Entity>(), rcom);

            RegisterSystem(RicochetSystem);
            RegisterSystem(RenderSystem);
        }

        protected override void OnStart()
        {
            
        }


        protected override void OnStop()
        {
        }

        protected override void OnDispose()
        {
            if (RicochetSystem != null)
            {
                RicochetSystem.Dispose();
                RicochetSystem = null;
            }

            if (RenderSystem != null)
            {
                RenderSystem.Dispose();
                RenderSystem = null;
            }
        }
    }
}
